import request from '../utils/request';

export function fetch({ dataId, dataLevel, dataTime }) {
  let ret = null;
  switch (dataId) {
    case 'householdNum':
    case 'registerPop':
    case 'residentPop':
    case 'urbanPop':
    case 'growthRate':
    case 'birthRate':
    case 'deathRate':
      ret = dataTime
        ? request(`/api/open/yearbook/population?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/population`);
      break;
    case 'totalGdp':
    case 'firstVal':
    case 'secondVal':
    case 'thirdVal':
    case 'perVal':
      ret = dataTime
        ? request(`/api/open/yearbook/gdp?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/gdp`);
      break;
    case 'totalTrade':
    case 'importVal':
    case 'exportVal':
      ret = dataTime
        ? request(`/api/open/yearbook/trade?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/trade`);
      break;
    case 'employedNum':
    case 'firstNum':
    case 'secondNum':
    case 'thirdNum':
      ret = dataTime
        ? request(`/api/open/yearbook/employment?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/employment`);
      break;
    case 'totalAssets':
    case 'firstAssets':
    case 'secondAssets':
    case 'thirdAssets':
    case 'estateVal':
    case 'residenceVal':
    case 'increaseVal':
    case 'saleArea':
    case 'saleVal':
      ret = dataTime
        ? request(`/api/open/yearbook/assets?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/assets`);
      break;
    case 'revenue':
    case 'budgetaryIn':
    case 'budgetaryExp':
      ret = dataTime
        ? request(`/api/open/yearbook/revenue?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/revenue`);
      break;
    case 'vilDisposableIn':
    case 'vilPerExp':
    case 'cityDisposableIn':
    case 'cityPerExp':
    case 'vilLivingArea':
    case 'cityLivingArea':
    case 'perDepBalance':
      ret = dataTime
        ? request(`/api/open/yearbook/life?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/life`);
      break;
    case 'totalAfaf':
    case 'agrVal':
    case 'forVal':
    case 'aniVal':
    case 'fishVal':
    case 'serviceVal':
      ret = dataTime
        ? request(`/api/open/yearbook/afaf?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/afaf`);
      break;
    case 'totalArea':
    case 'grainArea':
    case 'grainOutput':
    case 'rapeseedOutput':
    case 'cottonOutput':
    case 'fruitsOutput':
    case 'teaOutput':
    case 'cocoonsOutput':
    case 'oilseedsOutput':
    case 'meatOutput':
    case 'aquaticOutput':
    case 'totalPower':
    case 'elePower':
    case 'ferUsage':
      ret = dataTime
        ? request(`/api/open/yearbook/agriculture?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/agriculture`);
      break;
    case 'enterpriseNum':
    case 'employeeNum':
    case 'totalAssets':
    case 'liquidAssets':
    case 'fixedAssets':
    case 'mainIncome':
    case 'totalProfit':
      ret = dataTime
        ? request(`/api/open/yearbook/industry?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/industry`);
      break;
    case 'railwayPVol':
    case 'higiwayPVol':
    case 'waterPVol':
    case 'airPVol':
    case 'railwayFVol':
    case 'higiwayFVol':
    case 'waterFVol':
    case 'airFVol':
    case 'highwayMil':
      ret = dataTime
        ? request(`/api/open/yearbook/pftraffic?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/pftraffic`);
      break;
    case 'fixedTelNum':
    case 'mobileTelNum':
    case 'internetNum':
      ret = dataTime
        ? request(`/api/open/yearbook/communication?regionLevel=${dataLevel}&statYear=${dataTime}`)
        : request(`/api/open/yearbook/communication`);
      break;
    case 'ele':
    case 'industryEle':
    case 'internetNum':
      ret = dataTime ?
        request(`/api/open/yearbook/electricity?regionLevel=${dataLevel}&statYear=${dataTime}`) : request(`/api/open/yearbook/electricity`);
      break;
    case 'depositBalance':
    case 'loanBalance':
      ret = dataTime ? request(`/api/open/yearbook/finance?regionLevel=${dataLevel}&statYear=${dataTime}`) : request(`/api/open/yearbook/finance`);
      break;
    case 'totalNum':
    case 'inventionNum':
    case 'practicalNum':
    case 'appearanceNum':
      ret = dataTime ? request(`/api/open/yearbook/patent?regionLevel=${dataLevel}&statYear=${dataTime}`) : request(`/api/open/yearbook/patent`);
      break;
    case 'highSch':
    case 'specialSch':
    case 'middleSch':
    case 'primarySch':
    case 'highSchNum':
    case 'researchNum':
      ret = dataTime ? request(`/api/open/yearbook/education?regionLevel=${dataLevel}&statYear=${dataTime}`) : request(`/api/open/yearbook/education`);
      break;
    case 'totalRd':
    case 'aboveState':
    case 'largeMedium':
      ret = dataTime ? request(`/api/open/yearbook/rdinput?regionLevel=${dataLevel}&statYear=${dataTime}`) : request(`/api/open/yearbook/rdinput`);
      break;
    case 'sunshine':
    case 'precipitation':
      ret = dataTime ? request(`/api/open/yearbook/weather?regionLevel=${dataLevel}&statYear=${dataTime}`) : request(`/api/open/yearbook/weather`);
      break;

    case 'college':
      ret = dataTime ? request(`/api/open/innovation/innovation?regionLevel=${dataLevel}&statYear=${dataTime}`) : request(`/api/open/yearbook/innovation`);
      break;

    //实时数据暂用年鉴分类 以防后期调整
    case 'aqiValue':
    case 'pm25Value':
    case 'pm10Value':
    case 'coValue':
    case 'no2Value':
    case 'o3Value':
    case 'so2Value':
      ret = request(`/api/open/monitor/aqi`);
      break;

    case 'nationalOverview':
      ret = request(`/api/open/overview/overview`);
      break;

    //机场吞吐量数据
    case 'pvol':
    case 'gvol':
    case 'svol':
    case 'pgrowth':
    case 'ggrowth':
    case 'sgrowth':
      ret = request(`/api/open/traffic/airport?statYear=${dataTime}`);
      break;

    //水质数据
    case 'thewlevel':
    case 'prewlevel':
    case 'wph':
    case 'wdo':
    case 'codmn':
    case 'nhthn':
      ret = request(`/api/open/monitor/water`);
      break;

    case 'innovation':
      ret = request(`/api/open/innovation/innoval?statYear=2017`);
      break;

    //港口数据
    case 'cargoVal':
      // case 'gYearTotal':
      // case 'gMonth':
      // case 'gProportion':
      // case 'gfYearTotal':
      // case 'gfMonth':
      // case 'gfProportion':
      // case 'pYearTotal':
      // case 'pMonth':
      // case 'pProportion':
      // ret = request(`/api/open/traffic/port?statTime=${dataTime}`);
      ret = dataTime ? request(`/api/open/traffic/port2?statYear=${dataTime}`) : request(`/api/open/traffic/port2`);
      break;

    case 'transport':
      ret = request(`/api/open/traffic/transGoods`);
      break;

    case 'consumption':
      ret = request(`/api/open/economics/highConsume`);
      break;


    //echarts示例
    case 'ic':
    case 'car':
    case 'carRelation':
    case 'pay':
    case 'development':
    case 'corpHeatmap':
    case 'connection1':
    case 'techCooperation':
      ret = request(`/api/open/monitor/water`);
      break;

    case 'mobileSignalingPlane':
    case 'mobileSignalingCube':
      ret = request(`/api/open/hongqiao/mobile?statTime=${dataTime}`);
      break;
    case 'shanghaiInflow':
      //ret = request(`/api/open/people/migration`);
      ret = request(`/api/open/people/migrationCurrent`);
      break;
  }
  return ret;
}
